#include<stdio.h>
int main ()
{
	long int n,re=1;
	int i,j,k,x=0;
	scanf("%lld",&n);
	if(n<10)
	re=n;
	m:;
	
	if(n>=10)
	{
		while(n>=10)
		{
			x=n%10;
			n=n/10;
			if(x!=0)
			{
				re=re*x;
			}
		}
		if(n!=0)
		re=re*n;
		
	} 
	    
	 if(re>=10)
	 {
	 	n=re;
	 	re=1;
	 	goto m;
	 }
	 printf("%d",re);
	 return 0;
 } 
